load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "geopb",
    srcs = [
        "config.go",
        "geopb.go",
        "types.go",
    ],
    embed = [":geopb_go_proto"],
    importpath = "github.com/cockroachdb/cockroach/pkg/geo/geopb",
    visibility = ["//visibility:public"],
)

proto_library(
    name = "geopb_proto",
    srcs = [
        "config.proto",
        "geopb.proto",
    ],
    strip_import_prefix = "/pkg",
    visibility = ["//visibility:public"],
    deps = ["@com_github_gogo_protobuf//gogoproto:gogo_proto"],
)

go_proto_library(
    name = "geopb_go_proto",
    compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"],
    importpath = "github.com/cockroachdb/cockroach/pkg/geo/geopb",
    proto = ":geopb_proto",
    visibility = ["//visibility:public"],
    deps = ["@com_github_gogo_protobuf//gogoproto"],
)

go_test(
    name = "geopb_test",
    srcs = ["types_test.go"],
    embed = [":geopb"],
    deps = ["@com_github_stretchr_testify//require"],
)
